<template>
  <div>
    <el-form :model="merchantParam"
             ref="ruleForm"
             label-width="120px"
             style="width: 680px"
             size="small">
    <el-form-item label="营业执照" prop="licenseImg">
      <el-upload
        action="http://localhost:8301/merchantPhoto/upload"
        list-type="picture-card"
        :auto-upload=true
        :show-file-list="false"
        :on-success="onSuccess"
        name="file"
        :limit="1">
        <img v-show="merchantParam.licenseImg != null" :src="merchantParam.licenseImg" style="width:150px;heigh:150px">
        <i class="el-icon-plus" v-show="merchantParam.licenseImg == ''"></i>
      </el-upload>
    </el-form-item>
      <el-form-item style="text-align: center">
        <el-button size="medium" @click="handlePrev">上一步，填写身份证</el-button>
        <el-button type="primary" size="medium" @click="handleFinishCommit">完成，提交店铺信息</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  export default {
    name: "merchantLicenseDetail",
    props: {
      merchantParam: {
        type: Object
      },
      isEdit: {
        type: Boolean,
        default: false
      }
    },
    data(){
      return {
        rules: {
          licenseImg: [{required: true, message: '请上营业执照', trigger: 'blur'}],
        }
      }
    },
    created () {
      console.log(this.merchantParam,"???????????营业执照????????????????")
    },
    methods:{
      onSuccess(data){
        console.log(data+"----------营业执照")
        this.merchantParam.licenseImg=data;
      },
      handlePrev(){
        this.$emit('prevStep')
      },
      handleFinishCommit(){
        this.$emit('finishCommit',this.isEdit);
      }
    }
  }

</script>
